<div id="block_prefs_<?php echo $block_instance['data']->id; ?>" style="display: none;">
	To add or remove categories, go to your <a href="/">index page</a>.
</div>

<?php if ($this->userland->logged_in()
		&& ($this->userland->current_user()->id == $content->user_id || $this->Membership_model->is_owner($bricabox->id))): ?>
<form>
	<select id="category_for_<?php echo $content->id; ?>" onchange="Ctgy.changeCat(<?php echo $content->id; ?>, <?php echo $block_instance['data']->id; ?>, <?php echo $bricabox->id; ?>);">
		<option value="-1"<?php if (!$content->category_id) echo ' selected="selected"'; ?>>none</option>
		<option value="-1">------------------------------</option>
		<?php
		if ($ctgys):
			foreach ($ctgys->result() as $ctgy):
		?>
		<option value="<?php echo $ctgy->id; ?>"<?php if ($content->category_id == $ctgy->id) echo ' selected="selected"'; ?>><?php echo $ctgy->name; ?></option>
		<?php
			endforeach;
		endif;
		?>
	</select>
</form>

<div id="cat_link_<?php echo $block_instance['data']->id; ?>">
	<?php if ($cat): ?><a href="/entries/categorized/<?php echo $cat->id; ?>"><?php echo $cat->name; ?></a><?php endif; ?>
</div>

<?php else: ?>
<?php if ($cat): ?><a href="/entries/categorized/<?php echo $cat->id; ?>"><?php echo $cat->name; ?></a><?php else: ?>Uncategorized<?php endif; ?>
<?php endif; ?>